
package com.insigma.business.qrcode.common.converter;


import com.insigma.business.qrcode.welfare.dto.CareWelfareMerchantStreetDTO;
import com.insigma.business.qrcode.merchant.entity.CareWelfareMerchantStreetDO;
import com.insigma.business.qrcode.merchant.dto.request.CareWelfareMerchantStreetInsertRequest;
import com.insigma.business.qrcode.merchant.dto.request.CareWelfareMerchantStreetSearchRequest;
import com.insigma.business.qrcode.merchant.dto.request.CareWelfareMerchantStreetUpdateRequest;
import com.insigma.business.qrcode.merchant.service.impl.CareWelfareMerchantStreetBSearcher;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class CareWelfareMerchantStreetProviderConverter extends AbstractConverter<CareWelfareMerchantStreetDTO, CareWelfareMerchantStreetDO> {

    private final static CareWelfareMerchantStreetProviderConverter careWelfareMerchantStreetConverter = new CareWelfareMerchantStreetProviderConverter();

    private CareWelfareMerchantStreetProviderConverter(){}

    
    public static CareWelfareMerchantStreetBSearcher convertRequestSO2Searcher(final CareWelfareMerchantStreetSearchRequest request){
        final CareWelfareMerchantStreetBSearcher careWelfareMerchantStreetBSearcher = new CareWelfareMerchantStreetBSearcher(request.getPageNo(),
        request.getPageSize(),request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request,careWelfareMerchantStreetBSearcher);
        return careWelfareMerchantStreetBSearcher;
    }

    
    public static CareWelfareMerchantStreetDO convertRequestUO2DO(final CareWelfareMerchantStreetUpdateRequest careWelfareMerchantStreetUpdateRequest) {
        final CareWelfareMerchantStreetDO careWelfareMerchantStreetDO = new CareWelfareMerchantStreetDO();
        BeanUtils.copyProperties(careWelfareMerchantStreetUpdateRequest,careWelfareMerchantStreetDO);
        
        return careWelfareMerchantStreetDO;
    }

    
    public static CareWelfareMerchantStreetDO convertRequestIO2DO(final CareWelfareMerchantStreetInsertRequest careWelfareMerchantStreetInsertRequest) {
        final CareWelfareMerchantStreetDO careWelfareMerchantStreetDO = new CareWelfareMerchantStreetDO();
        BeanUtils.copyProperties(careWelfareMerchantStreetInsertRequest,careWelfareMerchantStreetDO);
        return careWelfareMerchantStreetDO;
    }

    
    public static List<CareWelfareMerchantStreetDTO> convertResponseDOList2DTOList(final List<CareWelfareMerchantStreetDO> careWelfareMerchantStreetDOList){
        return careWelfareMerchantStreetConverter.convertGenericResponseDOList2DTOList(careWelfareMerchantStreetDOList);
    }

    
    public static CareWelfareMerchantStreetDTO convertResponseDO2DTO(final CareWelfareMerchantStreetDO careWelfareMerchantStreetDO){
        return careWelfareMerchantStreetConverter.convertGenericResponseDO2DTO(careWelfareMerchantStreetDO);
    }

    
    @Override
    protected CareWelfareMerchantStreetDTO doConvertResponseDO2DTO(CareWelfareMerchantStreetDO careWelfareMerchantStreetDO) {
        final CareWelfareMerchantStreetDTO careWelfareMerchantStreetDTO = new CareWelfareMerchantStreetDTO();
        try {
            BeanUtils.copyProperties(careWelfareMerchantStreetDO, careWelfareMerchantStreetDTO);
        }catch(RuntimeException be){
            
            return null;
        }
        return careWelfareMerchantStreetDTO;
    }

}
